<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>Javascript的Iterable</h1>

<script>
    //1.for of遍历
    /*
    let arr = [1,2,3,4,5];
    let map = new Map([['北京', "010"], ['上海', "021"], ['广州', "020"],['东京', "000"]]);
    let set = new Set(['orange','banana','apple']);

    for(let i of arr){
        console.log(i);
    }

    for(let m of map){
        console.log(m);
        console.log(m[0]+"="+m[1]);
    }

    for(let s of set){
        console.log(s);
    }
    */

    //2.for of与for in区别
    let arr = [1,2,3,4,5];
    arr.title='数组标题';

    //我们发现 for in 遍历出来的并不是元素值，而是属性。
    for(let e in arr){
        console.log(e);
    }

    for(let e of arr){
        console.log(e);
    }

</script>
</body>
</html>